package com.youku.utils
{
   import flash.display.*;
   import flash.geom.*;
   
   public class DrawUtil extends Object
   {
      
      public function DrawUtil() {
         super();
      }
      
      public static function Line(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:Number, param7:Number) : Shape {
         var _loc8_:Shape = new Shape();
         _loc8_.graphics.lineStyle(param7,param5,param6);
         _loc8_.graphics.moveTo(param1,param2);
         _loc8_.graphics.lineTo(param3,param4);
         return _loc8_;
      }
      
      public static function Circle(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:Number = 0, param7:uint = 16777215, param8:Number = -1) : Shape {
         var _loc9_:Shape = new Shape();
         _loc9_.graphics.beginFill(param4,param5);
         if(param6 > 0)
         {
            param8 = param8 == -1?param5:param8;
            _loc9_.graphics.lineStyle(param6,param7,param8);
         }
         _loc9_.graphics.drawEllipse(0,0,param3,param3);
         _loc9_.graphics.endFill();
         _loc9_.x = param1;
         _loc9_.y = param2;
         return _loc9_;
      }
      
      public static function Rectangle(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:Number, param7:Object, param8:Number, param9:Number = 0, param10:uint = 16777215, param11:flash.geom.Rectangle = null, param12:Number = -1, param13:String = null) : Shape {
         var _loc15_:Matrix = null;
         var _loc14_:Shape = new Shape();
         if(param7 == null)
         {
            _loc14_.graphics.beginFill(param5,param6);
         }
         else
         {
            _loc15_ = new Matrix();
            _loc15_.createGradientBox(param3,param4,param7.angle / 180 * Math.PI,0,0);
            _loc14_.graphics.beginGradientFill(param7.gradientType,param7.colors,param7.alphas,param7.ratios,_loc15_);
         }
         var param12:Number = param12 == -1?param6:param12;
         _loc14_.graphics.lineStyle(param8,param10,param8 == 0?0:param12,false,"normal",null,param13);
         if(param9 != 0)
         {
            _loc14_.graphics.drawRoundRect(0,0,param3,param4,param9,param9);
         }
         else
         {
            _loc14_.graphics.drawRect(0,0,param3,param4);
         }
         _loc14_.graphics.endFill();
         _loc14_.x = param1;
         _loc14_.y = param2;
         if(param11 != null)
         {
            _loc14_.scale9Grid = param11;
         }
         return _loc14_;
      }
      
      public static function RectangleSprite(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:Number, param7:Object, param8:Number, param9:Number = 0, param10:uint = 16777215, param11:flash.geom.Rectangle = null, param12:Number = -1, param13:String = null) : Sprite {
         var _loc15_:Matrix = null;
         var _loc14_:Sprite = new Sprite();
         if(param7 == null)
         {
            _loc14_.graphics.beginFill(param5,param6);
         }
         else
         {
            _loc15_ = new Matrix();
            _loc15_.createGradientBox(param3,param4,param7.angle / 180 * Math.PI,0,0);
            _loc14_.graphics.beginGradientFill(param7.gradientType,param7.colors,param7.alphas,param7.ratios,_loc15_);
         }
         var param12:Number = param12 == -1?param6:param12;
         _loc14_.graphics.lineStyle(param8,param10,param8 == 0?0:param12,false,"normal",null,param13);
         if(param9 != 0)
         {
            _loc14_.graphics.drawRoundRect(0,0,param3,param4,param9,param9);
         }
         else
         {
            _loc14_.graphics.drawRect(0,0,param3,param4);
         }
         _loc14_.graphics.endFill();
         _loc14_.x = param1;
         _loc14_.y = param2;
         if(param11 != null)
         {
            _loc14_.scale9Grid = param11;
         }
         return _loc14_;
      }
      
      public static function Triangle(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number = 0, param6:Boolean = false, param7:Number = 16777215, param8:String = null, param9:Number = 4) : Shape {
         var _loc10_:Shape = new Shape();
         var _loc11_:Number = param1 * Math.sqrt(3) / (param6?param9:2);
         _loc10_.graphics.beginFill(param2,param3);
         if(param5 > 0)
         {
            _loc10_.graphics.lineStyle(param5,param7);
         }
         _loc10_.graphics.moveTo(param1 / 2,0);
         _loc10_.graphics.lineTo(param1,_loc11_);
         _loc10_.graphics.lineTo(0,_loc11_);
         _loc10_.graphics.lineTo(param1 / 2,0);
         _loc10_.graphics.endFill();
         _loc10_.rotation = param4;
         return _loc10_;
      }
   }
}
